﻿using Prism.Commands;
using System;
using System.Collections.Generic;
using System.Text;

namespace AnChao.WPF.Controls.Prism.ViewModels
{
    public class CheckUserViewModel: DomainObject
    {
        private bool _isEnabled;
        public bool IsEnabled
        {
            get { return _isEnabled; }
            set { SetProperty(ref _isEnabled, value); }
        }

        private bool _canSave;
        public bool CanSave
        {
            get { return _canSave; }
            set { SetProperty(ref _canSave, value); }
        }


        public DelegateCommand<string> SubmitComand { get; private set; }
        
        public CheckUserViewModel()
        {
            SubmitComand = new DelegateCommand<string>(Submit, CanSubmit);
            SubmitComand = new DelegateCommand<string>(Submit, CanSubmit).ObservesProperty(() => IsEnabled);
            SubmitComand = new DelegateCommand<string>(Submit, CanSubmit).ObservesProperty(() => IsEnabled)
                                                                         .ObservesProperty<bool>(() => CanSave);
            SubmitComand = new DelegateCommand<string>(Submit).ObservesCanExecute(() => IsEnabled);
        }

        private void Submit(string paramater)
        {
            
        }

        private bool CanSubmit(string paramater)
        {
            return true;
        }

    }
}
